import { Controller, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { AppClassificationService } from './classification.service';
import { Classification } from './classification.entity';
import { ApiRes, ApiResType } from 'src/common/decorator/api-res.decorator';
import { Public } from 'src/common/decorator/public.decorator';

@ApiTags('app首页-分类模块')
@Controller('app/classification')
export class AppClassificationController {
  constructor(
    private readonly appClassificationService: AppClassificationService,
  ) {}

  @ApiOperation({
    summary: '查询分类列表',
  })
  @Post('/list')
  @Public()
  @ApiRes(Classification, ApiResType.ARRAY)
  async list() {
    return {
      data: await this.appClassificationService.findAll(),
    };
  }

  // @Get('test')
  // async chatTest() {
  //   const chat = {
  //     id: 3,
  //     content: [
  //       {
  //         type: 'text',
  //         text: '你好, 告诉我唐诗三百首有那几首',
  //         image_url: '',
  //       },
  //     ],
  //   };
  //   return this.gptService.streamPost(
  //     'https://api.aiskt.com/v1/chat/completions',
  //     {
  //       model: 'gpt-3',
  //       stream: true,
  //       messages: [
  //         {
  //           role: 'user',
  //           content: chat.content,
  //         },
  //       ],
  //     },
  //   );
  // }
}
